package com.alexrnl.BetaSeriesFileManager.API.entities;

import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.SortedSet;
import java.util.logging.Logger;

import com.alexrnl.BetaSeriesFileManager.API.entities.enums.Genre;
import com.alexrnl.BetaSeriesFileManager.API.entities.enums.StatusShow;

/**
 * Class representing a show.
 * @author Alex
 */
public class Show {
	private static Logger		T	= Logger.getLogger(Show.class.getName());

	private Integer				idTVDB;
	private String				title;
	private String				url;
	private String				description;
	private StatusShow			status;
	private URL					banner;
	private Collection<Genre>	genres;
	private SortedSet<Season>	seasons;
	private Note				note;

	/**
	 * Constructor #1.<br />
	 * Build a show using only a title and a URL.
	 * @param title
	 *            the title of the show
	 * @param url
	 *            the URL of the show
	 */
	public Show (final String title, final String url) {
		super();
		this.title = title;
		this.url = url;
		T.fine("Building a simple show.");
	}

	/**
	 * Constructor #2.<br />
	 * @param idTVDB
	 *            the TVDB id of the show
	 * @param title
	 *            the title of the show
	 * @param url
	 *            the URL of the show
	 * @param description
	 *            the description of the show
	 * @param status
	 *            the status of the show
	 * @param banner
	 *            the banner of the show
	 * @param note
	 *            the note of the show
	 */
	public Show (final Integer idTVDB, final String title, final String url,
			final String description, final StatusShow status, final URL banner, final Note note) {
		super();
		this.idTVDB = idTVDB;
		this.title = title;
		this.url = url;
		this.description = description;
		this.status = status;
		this.banner = banner;
		this.note = note;
		T.fine("Building a full show.");
	}

	/**
	 * Returns the idTVDB.
	 * @return the idTVDB
	 */
	public Integer getIdTVDB () {
		return idTVDB;
	}

	/**
	 * Sets the idTVDB.
	 * @param idTVDB
	 *            the idTVDB to set
	 */
	public void setIdTVDB (final Integer idTVDB) {
		this.idTVDB = idTVDB;
	}

	/**
	 * Returns the title.
	 * @return the title
	 */
	public String getTitle () {
		return title;
	}

	/**
	 * Sets the title.
	 * @param title
	 *            the title to set
	 */
	public void setTitle (final String title) {
		this.title = title;
	}

	/**
	 * Returns the URL.
	 * @return the URL
	 */
	public String getUrl () {
		return url;
	}

	/**
	 * Sets the URL.
	 * @param url
	 *            the URL to set
	 */
	public void setUrl (final String url) {
		this.url = url;
	}

	/**
	 * Returns the description.
	 * @return the description
	 */
	public String getDescription () {
		return description;
	}

	/**
	 * Sets the description.
	 * @param description
	 *            the description to set
	 */
	public void setDescription (final String description) {
		this.description = description;
	}

	/**
	 * Returns the status.
	 * @return the status
	 */
	public StatusShow getStatus () {
		return status;
	}

	/**
	 * Sets the status.
	 * @param status
	 *            the status to set
	 */
	public void setStatus (final StatusShow status) {
		this.status = status;
	}

	/**
	 * Returns the banner.
	 * @return the banner
	 */
	public URL getBanner () {
		return banner;
	}

	/**
	 * Sets the banner.
	 * @param banner
	 *            the banner to set
	 */
	public void setBanner (final URL banner) {
		this.banner = banner;
	}

	/**
	 * Returns the note.
	 * @return the note
	 */
	public Note getNote () {
		return note;
	}

	/**
	 * Sets the note.
	 * @param note
	 *            the note to set
	 */
	public void setNote (final Note note) {
		this.note = note;
	}

	/**
	 * Returns the genres.
	 * @return the genres
	 */
	public Collection<Genre> getGenres () {
		return genres;
	}

	/**
	 * Adds a genre to the show.
	 * @param genre
	 *            the genre to add
	 */
	public void addGenre (final Genre genre) {
		if (genres == null)
			genres = new ArrayList<>();
			genres.add(genre);
	}

	/**
	 * Returns the seasons.
	 * @return the seasons
	 */
	public SortedSet<Season> getSeasons () {
		return seasons;
	}

}
